<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
  <h1>10</h1>
  <script>
    let count=10;
    setInterval(f,1000);

    function f() {
      count--;
      let h = document.querySelector("h1");
      h.innerText = count;
    }
// 漫山遍野你的脸庞,唯有遗忘是最漫长,这是一条必经的路,没有指引出口的光
    let timer = setInterval(function () {
      console.log(count);
      if (count==5){
        clearInterval(timer);
      }
    },1000);

    setTimeout(function () {
      console.log("时间到!")
    },3000);
  </script>
</body>
</html>